<template>
<div class="vote-info">
  <div class="person">
    <!-- <span class="flower"></span> -->
    <ul>
      <li :style="personImg"></li>
      <li><img :src="camera" @click.passive="openVideo" alt="" v-if="Boolean(personlist.videoPath)" ><Myvideo v-if="Boolean(videoPath)"  :videoUrl="videoPath" :showDailog="showDailog" @changeDialog="getStatus"/></li>
    </ul>
    <ul>
      <li>
        <span>{{personlist.nickname}}</span>
        <span>(编号：{{personlist.code}})</span>
        <span>{{personlist.cityName}}</span>
      </li>
      <li>{{personlist.universityName}}</li>
      <li>{{personlist.department}}</li>
      <li>{{personlist.declaration}}</li>
      <li><span>{{personlist.votesNumber}}</span> <span>次守护</span> <span>排名</span><span>{{personlist.rank}}</span></li>
    </ul>
  </div>
  </div>
</template>
<script>
import {
  getServerHost,
  preventMove,
  GetRequest,
  checkMobile,
  checkQq,
  weChatRefresh
} from "@/assets/lib/tool.js";
import Myvideo from '@/components/com/Myvideo';
export default {
  components: { Myvideo },
  props: {
    personlist: {
      type: Object,
      require: true
    }
  },
  data() {
    return {
      camera: require('@/assets/img/show-video.png'),
      openid: GetRequest().openid,
      // pathUrl: 'http://118.212.184.170/wxjx/file/video',
      pathUrl: '',
      // pathUrlImg: 'http://118.212.184.170/wxjx/file/img',
      pathUrlImg: '',
      showDailog: false,
      videoPath: ''
    }
  },
  watch: {
    showDailog(val) {
      return val;
    },
    videoPath(val) {
      return val;
    }
  },
  computed: {

    personImg() {
      return {
        backgroundImage: `url(${this.pathUrlImg + this.personlist.image1Path}) `,
        backgroundRepeat: 'no-repeat',
        backgroundPosition: 'center center',
        backgroundSize: `100% 100%`
      }
    }
  },
  methods: {
    //显示用户的详情
    showPersonDetails(id) {
      // console.log(id);
      let vm = this;
      this.$router.push({ name: "vote", query: { openid: vm.openid, id: id } });
    },
    //显示视频
    openVideo() {
      // console.log(this.personlist.videoPath);
      if (!this.personlist.videoPath) {
        // this.$emit('changeVideo', true);
        this.alert = {
          show: true,
          title: '提示',
          msg: '当前参赛用户没有上传视频'
        }
      } else {
        this.showVideo();
        this.showDailog = true;
      }
    },
    showVideo() {
      this.noshow = false;
      this.videoPath = this.pathUrl + this.personlist.videoPath;
      // console.log(this.videoPath);
      return this.videoPath;
    },
    getStatus(e) {
      // console.log(e);
      this.showDailog = e;
    }
  }
}
</script>
<style lang="less" scoped>
.vote-info {
  width: 100%;
  padding: 10px 40px;
  min-height: 254px;
}
.person {
  padding: 20px 0;
  display: flex;
  justify-content: space-around;
  border-bottom: 2px solid #b0b0b0;
  ul:first-child {
    width: 143px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    li:first-child {
      margin: 0 auto;
      border-radius: 50%;
      width: 130px;
      height: 130px;
      border: 5px solid #e9a7bb;
    }
    li:nth-child(2) {
      margin-top: 12px;
      img {
        width: 67px;
        height: 52px;
      }
    }
  }
  ul:nth-child(2) {
    width: 325px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    li {
      text-align: left;
      line-height: 1.5em;
    }
    li:first-child {
      display: flex;
      justify-content: space-around;
      span:first-child {
        color: #515151;
        font-size: 22px;
        font-weight: bold;
      }
      span:nth-child(2) {
        margin-left: 12px;
        margin-right: auto;
        font-size: 14px;
        color: #d7d3d5;
      }
      span:nth-child(3) {
        font-size: 14px;
        color: #a2a1a2;
      }
    }
    li:nth-child(2) {
      font-size: 18px;
      color: #8b8b8b;
    }
    li:nth-child(3) {
      font-size: 16px;
      color: #8b8b8b;
    }
    li:nth-child(4) {
      margin: 24px 0 30px 0;
      font-size: 14px;
      color: #8b8b8b;
    }
    li:nth-child(5) {
      display: flex;
      justify-content: space-around;
      span:nth-child(1) {
        margin-right: 4px;
        font-size: 36px;
        color: #ef6690;
      }
      span:nth-child(2) {
        margin-right: auto;
        font-size: 14px;
        color: #8b8b8b;
      }
      span:nth-child(3) {
        margin-right: 10px;
        font-size: 22px;
        color: #afafaf;
      }
      span:nth-child(4) {
        font-size: 42px;
        color: #e24e6c;
      }
    }
  }
}
</style>
